<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="test"></div>
    <script src="../lib//react.development.js"></script>
    <script src="../lib/react-dom.development.js"></script>
    <script src="../lib/babel.min.js"></script>
    <script src="../lib/prop-types.js"></script>
    <script type="text/babel">
        class Demo extends React.Component {
            // 返回被 ref 标识的节点
            myRef = React.createRef()
            render() {
                return (
                    <div>
                        <input type="text" ref={this.myRef} placeholder="click" />
                        <button onClick={this.onClick}>click</button>
                    </div>
                )
            }
            onClick = () => {
                const { myRef:{current:{value}} } = this
                console.log(value)
            }
        }
        ReactDOM.render(<Demo />, document.getElementById('test'))
    </script>
</body>

</html>